package com.hxd.mall.utils.open

import android.app.ActivityManager
import android.content.Context

/**
 * Created by lixiang on 2019/3/10
 * WebView工具类
 */
object SystemUtil {
    /**
     * 获取进程名称
     */
    fun getProcessName(context: Context): String? {
        val am: ActivityManager =
            context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
        val runningApps = am.runningAppProcesses ?: return null
        for (proInfo in runningApps) {
            if (proInfo.pid == android.os.Process.myPid()) {
                if (proInfo.processName != null) {
                    return proInfo.processName
                }
            }
        }
        return null
    }

}